﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace WcfServiceIIS
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        string GetMessage();

        [OperationContract]
        GetLotterNumberResult GetLotterNumberCollection(ref Pagenation page);
    }

    [DataContract]
    public class GetLotterNumberResult
    {
        [DataMember]
        public IList<LotterNumber> lotterNumberCollection { get; set; }

        [DataMember]
        public Pagenation PageInfo { get; set; }
    }

    [DataContract]
    public class LotterNumber
    {
        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public string Number { get; set; }

    }

    [DataContract]
    public class Pagenation
    {
        [DataMember]
        public int PageIndex { get; set; }

        [DataMember]
        public int PageSize { get; set; }

        public int StartRecordIndex { get { return PageIndex > 1 ? (PageIndex - 1) * PageSize : 0; } }

        public int EndRecordIndex { get { return (PageIndex * PageSize) < Count ? PageIndex * PageSize : Count; } }

        [DataMember]
        public int Count { get; set; }
    }
}
